#coding:utf-8
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import precision_recall_curve
plt.figure("P-R Curve")
plt.title('Precision/Recall Curve')
plt.xlabel('Recall')
plt.ylabel('Precision')
#pre为precision，y_scores为recall


y_scores = np.array([1/7,2/7,2/7,3/7,4/7,5/7,5/7,6/7,6/7,1])
pre = np.array([1,1,2/3,0.75,0.8,5/6,5/7,0.75,6/9,0.7])
plt.figure("P-R Curve")
plt.title('Precision/Recall Curve')
plt.xlabel('Recall')
plt.ylabel('Precision')
plt.plot(y_scores, pre)